<extend name="Layout/base" />
<block name="css">
	<style>
		.el-main {
			padding: 20px;
		}
		.orderbox {
			padding: 20px;
			background: #fff;
			border: 1px solid #ccc;
		}
		.ordertop {
			display: flex;
			justify-content: space-between;
			font-size: 14px;
			padding-bottom: 15px;
			border-bottom: 1px solid #ccc;
		}
		.ordertop .title {
			height: 20px;
			line-height: 20px;
		}
		.accept {
			border: 1px solid #ccc;
			border-radius: 6px;
			padding: 5px;
		}
		.orderdetail {
			padding: 20px 0;
			display: flex;
			margin-top: 20px;
			border-bottom: 1px solid #ccc;
		}
		.workerinfo {
			width: 50%;
			display: flex;
		}
		.infotitle {
			font-size: 20px;
			white-space: nowrap;
		}
		.baseinfo {
			display: flex;
			align-items: center;
		}
		.baseinfo p {
			margin-top: 5px;
		}
		.baseinfo p span {
			margin-left: 20px;
			/*white-space: nowrap;*/
		}
		.workerinfo .img img {
			width: 100px;
			height: 100px;
			border-radius: 50%;
			margin-left: 20px;
		}
		.jobinfo {
			display: flex;
			padding: 20px 0;
			border-bottom: 1px solid #ccc;
		}
		.otherinfo {
			display: flex;
			padding-top: 20px;
		}
		.btns {
			text-align: center;
			margin: auto;
			margin-top: 40px;
			width: 30%;
			display: flex;
			justify-content: space-between;
		}
		.partnertitle {
			display: inline-block;
			width: 80px;
		}
		.partnername {
			margin-left: 80px;
			margin-top: 10px;
		}
	</style>
</block>
<block name="content">
	<div class="orderbox">
		<div class="ordertop">
			<div class="title">
				<span style="color:#55a8fe;font-weight: bold;">师傅资料审核---{{type}}</span>
			</div>
		</div>
		<div class="orderdetail">
			<div class="workerinfo">
				<div class="infotitle">基础信息</div>
				<div class="baseinfo">
					<div class="img"><img src="img/logo.png" alt=""></div>
					<div>
						<p><span>用户姓名</span><span style="margin-left:30px;">{$data['name']}</span></p>
						<p><span>用户手机</span><span style="margin-left:30px;">{$data['mobile']}</span></p>
						<p><span>所属城市</span><span style="margin-left:30px;">{$data['city']}</span></p>
						<p><span>身份证号</span><span>{$data['certid']}</span></p>
						<p><span>服务范围</span><span>{$data['service_area']}</span></p>
					</div>
				</div>
			</div>
		</div>
		<div class="jobinfo">
			<div class="workerinfo">
				<div class="infotitle">任务信息</div>
				<div class="baseinfo">
					<div>
						<p><span>注册时间：</span><span>{:format_date($data['add_time'])}</span></p>
						<p><span>完成任务：</span><span>30</span></p>
						<p><span>累计金额：</span><span>18990</span></p>
						<p><span>剩余金额：</span><span>2648</span></p>
						<p><span>银行账号：</span><span></span></p>
						<p><span>微信账号</span><span></span></p>
					</div>
				</div>
			</div>
			<div class="workerinfo">
				<div class="infotitle">个人资料</div>
				<div class="baseinfo">
					<div>
						<p><span>性别：</span><span>{:sex2Str($data['sex'])}</span></p>
						<p><span>年龄：</span><span>{$data['age']}</span></p>
						<p><span>专长：</span><span>{:specialty2Str($data['specialty'])}</span></p>
					</div>
				</div>
			</div>
		</div>
		<div class="otherinfo">
			<div class="infotitle">其他信息</div>
			<div style="margin-left:30px;">
				<div><span class="partnertitle">所属合伙人:</span></div>
				<div class="partnername">{$data['partner_name']}</div>
			</div>
		</div>
		<div class="btns"> <el-button type="primary" @click="checkTrue">审核通过</el-button> <el-button @click="checkFalse">审核不通过</el-button></div>
	</div>
</block>
<block name="js">
	<script>
        new Vue({
            el: '#app',
            data: function() {
                return {
                    type: '',
					param: {
                        id: '{$data["id"]}',
                        status: ''
					}
                }
            },
            beforeCreate() {
                this.$nextTick( () => {
                    this.getOrderNo()
                })
            },
            methods: {
                // 获取上一页面携带的参数
                getOrderNo()  {
                    var url = location.search
                    var params = new Object()
                    if (url.indexOf("?") != -1) {
                        var str = url.substr(1)
                        var strs = str.split("&")
                        for (var i = 0; i < strs.length; i++) {
                            params[strs[i].split("=")[0]] = (strs[i].split("="[i]))
                        }
                        if(params.type[1] == 1) {
                            this.type = "资料审核"
                        } else {
                            this.type = "添加城市合伙人"
                        }
                    }
                },
                checkTrue: function () {
					this.param.status = '3';
					this.showCheckDialog();
                },
                checkFalse: function () {
                    this.param.status = '2';
                    this.showCheckDialog();
                },
                showCheckDialog: function () {
                    var _this = this;
					_this.$prompt('请输入审核理由', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                    }).then(({ value }) => {
                        _this.param.audit_info = value;
                        $.post(HOME_URL+"/orderAdmin/Worker/check", _this.param, function (data) {
							if(data.status){
                                _this.$message({
                                    type: 'success',
                                    message: '审核成功'
                                });
                                setTimeout(function () {
									location.href = HOME_URL + "/orderAdmin/Worker/checkinfo?id=" + _this.param.id;
                                }, 1000);
							}else{
                                _this.$message.error('审核失败');
							}
                        }, 'json');

                    }).catch(() => {
                    });
                }
            }
        });
	</script>
</block>